package com.common.project.common;

import cn.hutool.json.JSONUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName StatusCode
 * @Description
 * @Author jiangshicun@bicai365.com
 * @Date 2019/6/20 13:49
 */
public interface StatusCode {
    String getCode();

    String getMessage();

    static String toJson(StatusCode errorCode) {
        Map<String, Object> map = new HashMap();
        map.put("code", errorCode.getCode());
        map.put("message", errorCode.getMessage());
        return JSONUtil.toJsonStr(map);
    }
}
